<template>
  <div>
      <div
      class="container"
      v-for="item of comingSoon"
      :key="item._id"
      @click="handleClick(item._id)"
    >
      <img :src="item.pic" alt="" class="logo" />
      <div class="text">
        <h3>{{ item.title }}</h3>
        <p>观众评分{{ item.rating }}</p>
        <p>{{ item.slogo }}</p>
      </div>
      <button>购票</button>
    </div>
  </div>
</template>

<script>
export default {
    data(){
        return {
            comingSoon:[]
        }
    },
    mounted(){
        this.$http("/api/movie/comingSoon").then(res=>{
            // console.log(res.data.res)
            this.comingSoon = res.data.res
        })
    },
    methods:{
        handleClick(val){
       var id = val;
       console.log(val)
       this.$router.push(`/MovieDetail?id=${id}`)
     }
    }
}
</script>

<style scoped>
.container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px;
  z-index: 1000;
  /* margin-top: 50px; */
}
.logo {
  width: 60px;
  height: 75px;
}
.container button {
  width: 60px;
  height: 30px;
  border: 1px solid orange;
  color: orange;
}
.text {
  width: 200px;
}
</style>